#ifndef DELEGATE_H
#define DELEGATE_H

#include <QStyledItemDelegate>

class ComboDelegate: public QStyledItemDelegate
{
    Q_OBJECT    
    public :
    ComboDelegate(QObject * parent = 0);
    ~ComboDelegate();

    QSize sizeHint(const QStyleOptionViewItem &option,
                   const QModelIndex &index ) const;
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                           const QModelIndex &index) const;
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;

    private :
        QHash<int,QString> m_hashConditions;
        QHash<int,QString> m_hashTypesOfDocuments;
        QHash<int,QString> m_hashConjonctions;
};

class DateDelegate: public QStyledItemDelegate
{
    Q_OBJECT    
    public :
    DateDelegate(QObject * parent = 0);
    ~DateDelegate();

    QSize sizeHint(const QStyleOptionViewItem &option,
                   const QModelIndex &index ) const;
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                           const QModelIndex &index) const;
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
};

class TokenTerrainDelegate: public QStyledItemDelegate
{
    Q_OBJECT    
    public :
    TokenTerrainDelegate(QObject * parent = 0);
    ~TokenTerrainDelegate();

    QSize sizeHint(const QStyleOptionViewItem &option,
                   const QModelIndex &index ) const;
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                           const QModelIndex &index) const;
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
    private :
    QHash<int,QString> m_hashOfTokens;
};

class IndexOfValueInLineDelegate: public QStyledItemDelegate
{
    Q_OBJECT    
    public :
    IndexOfValueInLineDelegate(QObject * parent = 0);
    ~IndexOfValueInLineDelegate();

    QSize sizeHint(const QStyleOptionViewItem &option,
                   const QModelIndex &index ) const;
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                           const QModelIndex &index) const;
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;

    private :
        QHash<int,QString> m_hashIndexes;
};

#endif

